using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class JobSeekers_company : System.Web.UI.Page
{

    string connectionString = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        connectionString =
                     WebConfigurationManager.ConnectionStrings[
                       "RecruitVietnam"].ConnectionString;
        if (!IsPostBack)
        {
            ShowData("");
            
        }
    }
    
    
     
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        ShowData(txtKeyword.Text);
        GridView1.PageIndex = e.NewPageIndex;
    }
    void ShowData(string keyword)
    {
        try
        {
            Common cls= new Common(connectionString);
            GridViewHelper gridViewHelper = new GridViewHelper();
            gridViewHelper.FillDataTableToGridView(
            cls.GetDataTable("SPJobByCompany", 
            "@Keyword", keyword),
            this.GridView1, 15, 10, 
            PagerButtons.NumericFirstLast);
            if(this.GridView1.Rows.Count==0)
                literalError.Text = "Job not found.";
         }
         catch(Exception ex)
         {
            literalError.Text = ex.Message;
         }
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        ShowData(txtKeyword.Text);
    }
}
